package com.csproj.dispatch.repository;

import com.csproj.dispatch.domain.Dispatch;
import com.csproj.dispatch.domain.WarnInfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Repository;

import org.springframework.data.jpa.repository.*;

import java.util.List;


/**
 * Spring Data JPA repository for the WarnInfo entity.
 */
@SuppressWarnings("unused")
@Repository
public interface WarnInfoRepository extends JpaRepository<WarnInfo, String> , JpaSpecificationExecutor<WarnInfo>{

    @Query(value = "update WarnInfo set noticestatus=?2 where id=?1")
    @Modifying
    public void setNoticestatus(String id, String status);

    public List<WarnInfo> findAllByDispatchIdOrderByCreationTime(String dispatchId);

    public Page<WarnInfo> findAll(Specification specification, Pageable pageable);

    @Query(value = " from WarnInfo where dispatchId in ?1 ")
    public List<WarnInfo> findAllByDispatchId(List<String> dispatchId);

}
